<template>
  <div class="eheader">
    <el-menu
      :default-active="activeIndex"
      class="eheader-nav"
      mode="horizontal"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
    >
      <el-menu-item index="1">Home</el-menu-item>
      <el-menu-item index="2">Editor</el-menu-item>
      <el-menu-item index="3">
        <a href="https://gitee.com/chouchouji/wallpaper" target="_blank">
          Gitee
        </a>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";

@Component({
  components: {},
})
export default class Eheader extends Vue {
  activeIndex = "2";

  handleSelect(key: string): void {
    switch (key) {
      case "1":
        this.$router.push("/home").catch((err) => err);
        break;
      case "2":
        this.$router.push("/edit").catch((err) => err);
        break;
      case "3":
        console.log("进入项目的gitee主页");
        break;
      default:
        console.log("无效索引！！！");
        break;
    }
  }
}
</script>

<style lang="scss" scoped>
@import "@/style/common.scss";

.eheader {
  width: 100%;

  .eheader-nav {
    @include box-flex(flex-end);

    a {
      text-decoration: none;
    }
  }
}
</style>
